const { Service } = require('dx-router-admin');
const { UniIdLog } = require('dx-func-entity');

module.exports = class Logs extends Service {
	constructor(ctx) {
		super(ctx);
		this.entity = UniIdLog;
	}
	//添加登录日志
	async addLoginLog(user_id, username, type, state, mobile='', email='') {
		let logData = {
			device_id: this.$dx.request.deviceId,
			ip: this.$dx.request.ip,
			appid: this.$dx.request.appId,
			ua: this.$dx.request.ua,
			username,
			type,
			state,
			user_id,
			mobile,
			email,
		};
		return await this.insert(logData);
	}
};
